package org.cjstudio.holypoopsgrs_protytpe.resource;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class MySQL {
	
	public static final String DB_URL = "jdbc:mysql://localhost:3306/holypoopsgrs";
	public static final String DB_ID = "root";
	public static final String DB_PW = "root";

	public static ResultSet query(String query) throws SQLException {
		Connection conn = null;
		Statement stmt = null;
		ResultSet rs = null;
		
		try {
			conn = DriverManager.getConnection(MySQL.DB_URL, MySQL.DB_ID, MySQL.DB_PW);
			stmt = conn.createStatement();
			rs = stmt.executeQuery(query);
		} finally {
			if(stmt != null) stmt.close();
			if(conn != null) conn.close();
		}
		return rs;
	}
	
}
